package de.howie.android.logviewer.db;

public class VDataSets implements VDataSetsColumns{
	public static final String VIEW_NAME = "v_datasets";
	
	public static final  String SQL_CREATE = 
			"create view if not exists " + VIEW_NAME + 
			" as " + "select dsn." + DataSetNamesColumns.ID +
			", ds." + DataSetColumns.ID + " as " + VDataSetsColumns.DATASETID + ", dsn." + DataSetNamesColumns.DSNAME + 
			", ds." + DataSetColumns.DSUNIT + ", ds." + DataSetColumns.ISNUMERIC + ", ds." + DataSetColumns.MINVALUE + 
			", ds." + DataSetColumns.MAXVALUE + ", ds." + DataSetColumns.ISACTIVE + ", ds." + DataSetColumns.COLOR + 
			", dsn." + DataSetNamesColumns.LANGUAGE +
			" from " + DataSetTbl.TABLE_NAME + " ds" +
			" left join " + DataSetNamesTbl.TABLE_NAME + " dsn" +
			" on ds." + DataSetColumns.ID + " = dsn." + DataSetNamesColumns.DSID + ";";
	
	public static final String SQL_DROP = "DROP VIEW IF EXISTS " + VIEW_NAME;
	
	public static final String[] ALL_COLUMNS = new String[] {
		ID,
		DATASETID,
		DSNAME,
		DSUNIT,
		ISNUMERIC,
		MINVALUE,	
		MAXVALUE,
		ISACTIVE,
		COLOR,
		LANGUAGE
	};
}
